home *** CD-ROM | disk | FTP | other *** search
- # SpecTcl, by S. A. Uhler
- # Copyright (c) 1994-1995 Sun Microsystems, Inc.
- #
- # See the file "license.txt" for information on usage and redistribution
- # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- #
- # help messages for GUI builder
- # This is a place holder
-
- # test simple field help
- # enable or disable help on a field by field basis
-
- proc test_help {{on 1}} {
- if {$on} {
- bind . <Leave> {
- catch {
- after cancel [set Cancel%W]
- unset Cancel%W
- }
- set _Message ""
- }
- bind . <Enter> {
- set Cancel%W [after 1500 field_help %W %X %Y]
- }
- } else {
- bind . <Leave> {}
- bind . <Enter> {}
- }
- }
-
- # display a help message for a widget
- # Widget could be destroyed in the mean time
-
- proc field_help {win X Y} {
- global Field_help _Message Widgets
- if {![winfo exists $win]} {return}
- if {$win == ""} {
- set _Message ""
- } elseif {[info exists Field_help($win)]} {
- # eval at global level so we can reference globals in
- # help messages
- uplevel #0 "set _Message \[subst [list $Field_help($win)]\]"
- } elseif {[info exists Widgets([winfo name $win])]} {
- upvar #0 [winfo name $win] data
- set _Message "$data(type) $data(item_name)"
- if {$data(help) != ""} {
- append _Message " ($data(help)"
- }
- } elseif {[regexp {((row)|(column))@[0-9]+} $win dummy what]} {
- set _Message "Click to insert a new $what"
- } elseif {[regexp {_outline:(..?)} $win dummy what]} {
- set _Message "Click and drag to change column or row span"
- } elseif {[catch {
- puts "Sorry, no help for $win"
- }]} {
- set _Message "The item you requested help for is gone!"
- }
- }
-
- # display a help message for a widget in its own toplevel
- # This is ugly (but there is no accounting for taste)
-
- proc Field_help {win X Y} {
- global Field_help
- catch "destroy .help"
- dputs "destroying help popup"
- if {$win == ""} {
- return
- } elseif {[info exists Field_help($win)]} {
- set _Message $Field_help($win)
- } elseif {[catch {
- set _Message "Sorry, no help for \"[winfo name $win]\""
- }]} {
- set _Message "The item you requested help for is gone!"
- }
- toplevel .help
- wm overrideredirect .help 1
- label .help.l -text $_Message -relief raised -bd 2
- pack .help.l
- wm geometry .help +[expr $X + 8]+[expr $Y + 8]
- }
-
- # These are the help messages - subst'd at the global scope
-
- array set Field_help {
- .can_xscroll "Use to manipulate the main canvas view"
- .can_yscroll "Use to manipulate the main canvas view"
- .can_row "Click to toggle resize behavior, drag to resize row"
- .can_column "Click to toggle resize behavior, drag to resize column"
- .palette "Click&drag for new widget, double-click for option sheet"
- .palette.button "Drag onto canvas to create an ordinary button"
- .palette.canvas "Drag onto canvas to create a canvas widget"
- .menu.menub "Misc. options menu"
- .entry "The text displayed on the current item"
- .label "This is just a label, it doesn't do anything - really!"
- .anchor "Which side of its slot the item sticks to"
- .just "Selects the text justification mode"
- .bgcolor "Selects the background color"
- .fgcolor "Selects the foreground color"
- .relief "Border style: flat, raised, sunken, ridged, or grooved" through all of the border reliefs"
- .relief.inside "Border style: flat, raised, sunken, ridged, or grooved" through all of the border reliefs"
- .style "Cycles through the text styles: plain, bold, italic, and both"
- .justify "Text justification: left, center, or right"
- .fill "Selects how the widget fills its slot"
- .font_size "Selects the point size for the font"
- .borderwidth "Selects how thick the border is"
- .fg_color "Choose the foreground color"
- .menu_bg_color "Choose the background color"
- .orient "Selects vertical or horizontal orientation"
- . "-"
- .frame#7 "This is a hidden passageway to the next level"
- .toolbar "The toolbar"
- .message "Message area"
- .can "Extend the canvas by dragging a widget here"
- .can.f "This is the canvas on which the interface is built"
- }
-
- # These are subject to change by whim of the menu edittor, and should
- # be dynamically calculated
-
- array set Field_help {
- .menu "Menu bar: click and hold on a word"
- .menu.mnu#1 "File menu: new, open, save, quit"
- .menu.mnu#8 "Edit menu: edit-code, cut, copy, paste"
- .menu.mnu#17 "Misc. Commands"
- .menu.mnu#27 "Preferences menu"
- .menu.mnu#30 "Help and quick tips"
- }
-